/*
 * Copyright (c) 2019. seven studio. @chengdu
 * seven studio in chengdu by lb
 * this project for snmp tool
 */

package com.xlx.openLink.threadtask.basetask;

import com.xlx.openLink.entity.pojo.Device;
import com.xlx.openLink.entity.pojo.Port;
import com.xlx.openLink.enums.DevTypeEnum;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentLinkedQueue;

public class PortSearchTask implements Runnable {


    private List<Device> deviceList;
    private ConcurrentLinkedQueue<Port> insertPortList;
    private ConcurrentLinkedQueue<Port> updatePortList;

    public PortSearchTask(List<Device> deviceList, ConcurrentLinkedQueue<Port> insertPortList, ConcurrentLinkedQueue<Port> updatePortList) {
        this.deviceList = deviceList;
        this.insertPortList = insertPortList;
        this.updatePortList = updatePortList;
    }

    @Override
    public void run() {
        deviceList.forEach(device -> {

           // doBiz();

        });

    }
    //
    //private void doBiz(List<Port> inList, List<Port> upList, List<Port> cacheList, List<Device> list) {
    //    list.forEach(dev -> {
    //        //判断是否是有端口
    //        if (!dev.getDevType().equalsIgnoreCase(DevTypeEnum.CameraType.getCode()) || !dev.getDevType().equalsIgnoreCase(DevTypeEnum.UnkownType.getCode())
    //                || !dev.getDevType().equalsIgnoreCase(DevTypeEnum.ComputerType.getCode())) {
    //            try {
    //                List<Port> ports = new ArrayList<>();
    //                deviceService.initIfTable(dev, ports);
    //                List<Port> rePort = cacheManagerService.getPortList(dev.getPkGuid());
    //                for (Port p : ports) {
    //                    boolean flag = false;
    //                    for (Port rp : rePort) {
    //                        if (p.equals(rp)) {
    //                            deviceService.initData(rp, p);
    //                            upList.add(rp);
    //                            cacheList.add(p);
    //                            flag = true;
    //                            break;
    //                        }
    //                    }
    //                    if (!flag) {
    //                        inList.add(p);
    //                        cacheList.add(p);
    //                    }
    //                }
    //            } catch (Exception e) {
    //                log.error(e.getMessage());
    //            }
    //        }
    //        if (!cacheList.isEmpty()) {
    //            cacheManagerService.setPostList(dev.getPkGuid(), cacheList); //更新缓存
    //        }
    //    });
    //}


}
